﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using FinosLibrary;
using FinosAdmin.Logics;
namespace FinosAdmin
{
	/// <summary>
	/// Interaction logic for ServerInfo.xaml
	/// </summary>
	public partial class ServerInfo : Window
	{
        public static ServerInfo instance;
		public ServerInfo()
		{
			this.InitializeComponent();
			DataContext = this.GetInstance<Server>();
		}
        private void textBox3_SourceUpdated(object sender, DataTransferEventArgs e) {
            if (checkBox1.IsChecked == false) {
                textBox3.ScrollToEnd();
            }
        }
        protected override void OnClosed(EventArgs e) {
            base.OnClosed(e);
            instance = null;
        }
        public static void Open() {
            if (instance == null) {
                instance = new ServerInfo();
                instance.Show();
            } else {
                instance.Activate();
            }
        }
        private void button4_Click(object sender, RoutedEventArgs e) {
            textBox3.Text = "";
            textBox3.GetBindingExpression(TextBox.TextProperty).UpdateSource();
        }

        private void button7_Click(object sender, RoutedEventArgs e) {
            ModelLogic.doLogic("DeleteServerAddress", listBox2.SelectedIndex);
        }

	}
}